Repository navigation
feat(spec): the list_datasets output declares candidates for a term that matched nothing (ADR-0149 D3) - #34828
Conversation
…t matched nothing
`ListDatasetsOutputSchema` gains the optional `candidates`: pointers
`{ term, dataset, member }` to listed members the platform offers for a
clarifying question when a term matched no member of any listed dataset
(ADR-0149 D3). A candidate is not a match and is never selected; no
candidates is the key's absence, never an empty list. The per-term cap is
the exported `LIST_DATASETS_MAX_CANDIDATES_PER_TERM`.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
Generator output only, nothing hand-edited: `gen:schema` (authorable-surface, json-schema.manifest), `gen:api-surface`, `gen:export-origins`, `gen:declaration-map`, `gen:docs` (the dataset-tools reference page and the reference index counts) and `gen:strictness-ledger` (the `ai/` site count). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…eset An add-only note under D3 records the ruling: a term with no hit is answered with `candidates`, offered for a clarifying question and never selected; what counts as a hit, and rule 4's fallback, stand as written. The changeset declares the widening at `minor` for `@objectstack/spec`. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…st-datasets-candidates Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
`check:spec-parsed-alias` refuses a bare `z.input` alias that is neither pinned nor paired with an `XParsed`. The candidate entry is a plain object of strings with no default and no transform, so it takes a pin: 857 -> 858. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
"This note changes no word of rule 1" states what the candidates note does and leaves room for a later, separate note on rule 1's match targets. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 173 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e7e829db2417815e94bc622be37dc95a271ebdb9 && git checkout e7e829db2417815e94bc622be37dc95a271ebdb9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c513d62acdd342745bbfe29786ba4b644cd934fc 666309be7ec4379477340524ece0e735a22bd57b && git checkout -B drift-repro c513d62acdd342745bbfe29786ba4b644cd934fc && git merge --no-ff 666309be7ec4379477340524ece0e735a22bd57b
node scripts/docs-audit/affected-docs.mjs --json c513d62acdd342745bbfe29786ba4b644cd934fc |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfWpJ96QY9T7d8DvFg L1: ACCEPT · 2026-11-17T12:51ZHead-sha: 666309b 席位核对PR shape. Draft, base Scope vs claim. 13 paths, all inside the claim as amended by 6947893386. The amendment adds three paths:
Nothing under Declaration.
Governed / size. Check-runs at 666309b. 70 runs, every one Contract shape (as relayed for checking).
ADR-0149 D3 note.
Generated artifacts. Tests and ablations. Seven new cases. There are three ablations, each restored to the HEAD blob:
The body reports runs of the downstream consumers ( Docs made false? None. The reference page is regenerated and the module doc block names Must-fixNone. Should-fixNone. Notes
Next: seat L2 at CONTRACT_REVIEW_TIER (fable), then os-zhuang (Tier H, |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: Read for this record: card #34761 (body and all four comments, claim amendment 6947893386 included), ruling 6943126855 on #34691, PR #34828 (body, the 13-file list, the net diff from merge-base ① Derived judgments
② Semver level
Clause-②: yes (widening — an optional output field on a published schema). The line is the same in the PR body and in the changeset, and it is correct. ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix.
N1, the point the seat asked about: the ruling says 「返回候选数据集」 and the shape returns N2 (nit) — the cap cuts by catalogue order and the answer does not say when it cut. The description reads "at most 5 per term, the first in that order", and the order is terms as sent, datasets as listed, measures before dimensions. So for a common word (the near-miss words that motivated the ruling are generic: 金额, 销售额, N3 (nit) — the permission sentence is a duty of the executor, and no schema holds it. "Every candidate is a member this caller may read, listed in N4 (nit) — the module doc block credits the candidate rule to card #31589. The rewritten sentence lists "the rule that finds a zero-match term's candidates" among the things that "belong to
N5 (nit) — the note says "this PR" where ADR-0011's form gives the PR number. The card asked for ADR-0011:238's form, which reads "PR #33725, Nits only: N2 and N3 go to #34763, N4 and N5 are left as accepted deviations or folded into a later edit. No delta review is owed. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG 席位记录 · 2026-11-17T13:01ZHead-sha: 维护者速读(终稿)
席位意见:建议批准。请留意一点:裁决选项的字面是「候选数据集」,实际返回的是「数据集 + 其中的指标或维度」。每条候选都带数据集名,所以不少于裁决所说,只是更细一层;而只靠数据集名,用户回答不了「你指的是哪个」, 席位核对
|
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzfR33NbV51QQU6R6bm
Fixes #34761
Clause-②: yes (widening — an optional output field on a published schema)
Metadata-protocol: added
Skills-docs: follow-up owed — skills/objectstack-ask/SKILL.md (zero-match row reads candidates once #34763 lands)
Served-tier: CONTRACT_REVIEW_TIER
维护者速读
list_datasets的返回结构新增可选成员candidates。用户的词在所有列出的数据集里一个成员都没精确命中时,平台列出可供反问的候选成员,每项指向同一份返回里的「数据集 + 成员」,每个词最多 5 个。ADR-0149 D3 末尾加一段只增不改的修订说明。本 PR 只声明形状,不改执行器。candidateswith near members (name, label, synonym) on a zero-match, only from what the caller may read #34763,它落地前没有返回会带这个字段,但 MCP 客户端读到的outputSchema现在就多出这一项。回滚即 revert 本 PR。packages/spec/src/ai/dataset-tools.zod.ts里candidates的.describe()文字,它是对外契约,也是 MCP 客户端读到的说明;②docs/adr/0149-ai-answers-business-questions-through-the-dataset-semantic-layer.mdD3 末尾的修订说明,看它是否如实转述裁决;③ 同一文件里DatasetTermCandidateSchema不带matchedOn,与卡片提案不同,理由在下面 Schema decisions。pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/ai/dataset-tools.test.ts,预期Tests 33 passed (33)。docs/adr/**与packages/spec/**)。What changes
packages/spec/src/ai/dataset-tools.zod.ts(62 lines added, 2 removed; the two removed lines are module doc block lines, rewritten to namecandidates):ListDatasetsOutputSchemagains one optional member,candidates: a list ofDatasetTermCandidateSchemawith at least one entry.DatasetTermCandidateSchema(typeDatasetTermCandidate):{ term, dataset, member }, all three required.memberisDatasetTermMatchSchema'smemberby reference, under its own description, so the member-reference format (measures.NAMEordimensions.NAME) is declared once.LIST_DATASETS_MAX_CANDIDATES_PER_TERM = 5, exported.matches,DatasetTermMatchSchema,DatasetTermMatchedOnand every other declaration in the file are untouched.packages/spec/src/ai/dataset-tools.test.ts: seven new cases (33 run in the file now). Six in a newlist_datasets candidatesblock, one in the JSON Schema projection block.packages/spec/src/type-alias-convention.pin.test.ts: one pin row for the new alias and the pinned count 857 to 858.check:spec-parsed-alias(ADR-0122) refuses a new bare input alias with no pin. See File surface below.packages/spec/{api-surface,authorable-surface,declaration-map,export-origins,json-schema.manifest}/ai.json,content/docs/references/ai/dataset-tools.mdx,content/docs/references/index.mdx(schema totals 1669 to 1670, AI 81 to 82),docs/audits/2026-07-unknown-key-strictness-ledger.counts/ai.md(96 to 97 object sites).docs/adr/0149-ai-answers-business-questions-through-the-dataset-semantic-layer.md: an amendment note at the end of D3, in ADR-0011's> **Amendment note**form. 11 lines added, 0 removed or changed..changeset/34761-list-datasets-candidates.md:@objectstack/specatminor.packages/services/service-analytics/**,packages/mcp/**orskills/**.Why
Ruled by the maintainer on #34691, fork F1, option B, option text verbatim 「B 零命中返回候选」 — 「现在就改服务器,list_datasets 零命中时返回候选数据集。专题席的新推荐。」 (ruling record
6943126855, relayed to #34659 as6943149235). It re-rules point E2 of #34659's record6940528935to that point's option A.With
terms,list_datasetsanswers the whole admitted catalogue, and a term with no match gets no pointer to the near members (the card's reading ofpackages/services/service-analytics/src/dataset-tools.ts), so what to do next is left to each client. A tool result is read by every client that made the call; a tool description is read only after the client picked the tool, and a skill only when it is installed and triggered.This PR is the spec half: the shape, and the record. The executor that fills the list and the tool descriptions are #34763.
Schema decisions
The card's proposal was a starting point ("the PR settles it and says why if it differs"). One point differs.
{ term, dataset, member, matchedOn }{ term, dataset, member }matchedOnsays which of the member's words the term equals after normalization. A candidate has no such equality, so the key would state something false. There is no "near which word" key either: D3 rule 1 names an embedding neighbour among the non-hits that may be offered, and an embedding neighbour is near no single word. Such a key would presume a substring or stem rule, and the rule is the executor's.datasetsdatasetsentry. The entry repeats none of them.termswere sent and a term matched no member of any listed dataset.min(1).optional()LIST_DATASETS_MAX_CANDIDATES_PER_TERM = 5maxItems: nothing in this PR refuses a sixth entry for one term.The new type alias is a bare input alias with a pin, not an alias paired with a
Parsedtwin: the schema has no default and no transform, so input and output types are the same (ADR-0122).Prior rulings read
The claim names four. None is crossed.
main" bullet names service-analytics: list_datasets fillscandidateswith near members (name, label, synonym) on a zero-match, only from what the caller may read #34763 as the card that fills the list and carries the branch to the model. The spec liveness ledger classifies authorable metadata keys and has no row for the dataset-tool output schemas;check:livenessexits 0 and asked for no row.Tests
Readings are on head
666309bewith a clean working tree, unless a row says otherwise.pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/ai/dataset-tools.test.ts src/type-alias-convention.pin.test.ts(verify lock)Test Files 2 passed (2),Tests 36 passed (36); lock lineVERDICT command-exit 0pnpm --filter @objectstack/spec typecheckthentest(verify lock), ona23b07c9check:test-typecheck: OK;Test Files 847 passed | 1 skipped (848);Tests 27175 passed | 1 skipped | 1 todo (27177);VERDICT command-exit 0. The one later commit,666309be, changes one sentence of the ADR note.pnpm --filter @objectstack/service-analytics testandpnpm --filter @objectstack/mcp test(verify lock)Test Files 218 passed (218),Tests 5548 passed | 335 skipped (5883); mcpTest Files 66 passed (66),Tests 1226 passed (1226);VERDICT command-exit 0pnpm exec eslint --no-inline-configon the three changed TypeScript filesThe two downstream packages are the ones outside spec that import the dataset-tool schemas (direction: consumers of spec). They ran against a spec
dist/that carries the new export.What the new cases pin
candidatesparses, and the parsed value keeps the list.candidateslist is refused, at pathcandidates.dataset,member,term, each required, and there is nomatchedOn.membertakes what a match'smembertakes and refuses what it refuses.list_datasetsoutputSchemahascandidatesas an array withminItems1 whose items requireterm,datasetandmember, andcandidatesis not in the output'srequiredlist.The built
dist/answers the same:requiredis["datasets"];candidatesistype: array,minItems: 1; its items aretype: object,required: ["term","dataset","member"],additionalProperties: false.Ablations (three, each restored)
Each mutation went through
scripts/ablation-replace.mjsondataset-tools.zod.ts, and each restore ended with "ok restored: blob == HEAD (bbb4dce7b5b8) andgit diff HEADis empty". The suite imports the schema by relative path fromsrc/, so there is nodist/leg..min(1)to.min(0)oncandidatesTests 2 failed | 31 passed (33): the empty-list case and the projection casecandidatesrenamedTests 3 failed | 30 passed (33): the keep-the-list case, the empty-list case, the projection casememberto a plain stringTests 1 failed | 32 passed (33): the member-format caseThe first attempt at the first ablation did not run. The tool refused it (the replacement text was a substring of the anchor, so the count moved 18 to 18) and restored the file. The row above is the second attempt with a narrower anchor.
Acceptance notes
candidateswith near members (name, label, synonym) on a zero-match, only from what the caller may read #34763 lands no answer carriescandidates. The tool'soutputSchemalists the optional member from this PR on. The ADR note says so in its last bullet.content/docs/references/index.mdxanddocs/audits/2026-07-unknown-key-strictness-ledger.counts/ai.mdare generator output (gen:docs,gen:strictness-ledger).packages/spec/src/type-alias-convention.pin.test.tsis a hand edit thatcheck:spec-parsed-aliasdemands for any new bare input alias.node scripts/pm/overlap-check.mjsexits 1: both PRs move the totals incontent/docs/references/index.mdxand the pinned count intype-alias-convention.pin.test.ts.origin/mainmerges cleanly. Whichever lands second mergesmain, re-runsgen:docsand sets the count to the sum.6946563869; not read here) and rule 1 of D3 will need a qualifier for it. Card spec: list_datasets answers a term with no match with acandidateslist, never selected; ADR-0149 D3 gains the amendment note #34761 does not carry that amendment (body and both comments re-read after the last commit; the card was last updated 2026-11-17T10:53:47Z), so this note does not write it. The note is one self-contained block and changes no existing D3 sentence, so a later sentence can be added to it.6943126855describes candidates as "near matches, with a note that several readings may exist". This PR carries that as the member's description ("possible readings of a term ... for a clarifying question"), not as a text field in the result. A result field for it would be a second, per-answer copy of guidance text, which M1 A keeps out of the spec. Raised in the dev report as an open question.z.object. The strictness count forai/moves 96 to 97 object sites;ai/is an untriaged directory in that ledger.Skills-docs:line arrives with PR docs(skills): add objectstack-ask, a skill for answering business questions over MCP #34792 and is not onmainyet.Verification
node scripts/pm/dispatch-gates.mjs --commandsat666309bederives 109 commands.--rananswers: "109 derived famil(ies) accounted for — 109 run, 0 NOT-MEASURED", exit 0.check:generatedexited 1, all twelve for one cause:dist/older than the sources after the pin edit, or a package not built.check:type-check-debthit my runner's 300 s cap. Afterpnpm --workspace-concurrency=2 --filter '@objectstack/lint...' build, and afterpnpm check:type-check-debtrun to its end (exit 0, "0 ledger entr(ies) re-measured"; that run does aturbo run buildover the packages under the verify lock), all thirteen exited 0 on a re-run.node scripts/check-changeset-no-major.mjs --base origin/mainwith apull_requestevent carrying this title and body: exit 0, "LEVEL AXIS: this PR declares clause-②yes (widening)and metadata-protocoladded, and no package whose published source ... it moves is gradedpatch". Control: the same event withMetadata-protocol: noneexits 1, "metadata-protocol declaresnonewhile an authorable-surface or authorable-defaults baseline moved" (packages/spec/authorable-surface/ai.json). That is why the claim's provisionalnoneisaddedhere, withminor.pnpm check:skill-frame-freshnessexit 0.pnpm check:dev-prereqsexit 1: "34 of 107 workspace packages declare an entry point under dist/ that is not on disk" in this worktree (the three it names are underui/; the gates above needed none of them). That is this machine's state, not a reading of the diff.test:repo, the repo-widepnpm lintand the rest of the farm. No full dogfood run: the title has no!and the declaration has no(narrowing)arm.origin/mainat3bbda33bthroughscripts/pm/os-regen-merge.sh.Selected verdict lines
check:generatedcheck:spec-parsed-aliascheck:api-surfacecheck:export-originscheck:docscheck:adr-symbol-anchorscheck-adr-linkscheck:adr-indexcheck-empty-changesetcheck:nul-bytesHuman Minimum
packages/specholds no runtime logic.pnpm lintis left to CI (the three changed TypeScript files lint clean).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code